/**
 */
package org.mro.grib.model.files.secondEdition.dataRepresentations.impl;

import java.nio.ByteBuffer;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import org.mro.grib.model.files.secondEdition.dataRepresentations.DataRepresentationTemplate53;
import org.mro.grib.model.files.secondEdition.dataRepresentations.DataRepresentationsPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Data Representation Template53</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.mro.grib.model.files.secondEdition.dataRepresentations.impl.DataRepresentationTemplate53Impl#getOrderOfSpatialDifferencing <em>Order Of Spatial Differencing</em>}</li>
 *   <li>{@link org.mro.grib.model.files.secondEdition.dataRepresentations.impl.DataRepresentationTemplate53Impl#getExtraDifferencingOctetsNumber <em>Extra Differencing Octets Number</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class DataRepresentationTemplate53Impl extends DataRepresentationTemplate52Impl implements DataRepresentationTemplate53 {
	/**
	 * The default value of the '{@link #getOrderOfSpatialDifferencing() <em>Order Of Spatial Differencing</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getOrderOfSpatialDifferencing()
	 * @generated
	 * @ordered
	 */
	protected static final byte ORDER_OF_SPATIAL_DIFFERENCING_EDEFAULT = 0x00;

	/**
	 * The cached value of the '{@link #getOrderOfSpatialDifferencing() <em>Order Of Spatial Differencing</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getOrderOfSpatialDifferencing()
	 * @generated
	 * @ordered
	 */
	protected byte orderOfSpatialDifferencing = ORDER_OF_SPATIAL_DIFFERENCING_EDEFAULT;

	/**
	 * The default value of the '{@link #getExtraDifferencingOctetsNumber() <em>Extra Differencing Octets Number</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getExtraDifferencingOctetsNumber()
	 * @generated
	 * @ordered
	 */
	protected static final byte EXTRA_DIFFERENCING_OCTETS_NUMBER_EDEFAULT = 0x00;

	/**
	 * The cached value of the '{@link #getExtraDifferencingOctetsNumber() <em>Extra Differencing Octets Number</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getExtraDifferencingOctetsNumber()
	 * @generated
	 * @ordered
	 */
	protected byte extraDifferencingOctetsNumber = EXTRA_DIFFERENCING_OCTETS_NUMBER_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected DataRepresentationTemplate53Impl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return DataRepresentationsPackage.Literals.DATA_REPRESENTATION_TEMPLATE53;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public byte getOrderOfSpatialDifferencing() {
		return orderOfSpatialDifferencing;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setOrderOfSpatialDifferencing(byte newOrderOfSpatialDifferencing) {
		byte oldOrderOfSpatialDifferencing = orderOfSpatialDifferencing;
		orderOfSpatialDifferencing = newOrderOfSpatialDifferencing;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, DataRepresentationsPackage.DATA_REPRESENTATION_TEMPLATE53__ORDER_OF_SPATIAL_DIFFERENCING, oldOrderOfSpatialDifferencing, orderOfSpatialDifferencing));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public byte getExtraDifferencingOctetsNumber() {
		return extraDifferencingOctetsNumber;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setExtraDifferencingOctetsNumber(byte newExtraDifferencingOctetsNumber) {
		byte oldExtraDifferencingOctetsNumber = extraDifferencingOctetsNumber;
		extraDifferencingOctetsNumber = newExtraDifferencingOctetsNumber;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, DataRepresentationsPackage.DATA_REPRESENTATION_TEMPLATE53__EXTRA_DIFFERENCING_OCTETS_NUMBER, oldExtraDifferencingOctetsNumber, extraDifferencingOctetsNumber));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case DataRepresentationsPackage.DATA_REPRESENTATION_TEMPLATE53__ORDER_OF_SPATIAL_DIFFERENCING:
				return getOrderOfSpatialDifferencing();
			case DataRepresentationsPackage.DATA_REPRESENTATION_TEMPLATE53__EXTRA_DIFFERENCING_OCTETS_NUMBER:
				return getExtraDifferencingOctetsNumber();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case DataRepresentationsPackage.DATA_REPRESENTATION_TEMPLATE53__ORDER_OF_SPATIAL_DIFFERENCING:
				setOrderOfSpatialDifferencing((Byte)newValue);
				return;
			case DataRepresentationsPackage.DATA_REPRESENTATION_TEMPLATE53__EXTRA_DIFFERENCING_OCTETS_NUMBER:
				setExtraDifferencingOctetsNumber((Byte)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case DataRepresentationsPackage.DATA_REPRESENTATION_TEMPLATE53__ORDER_OF_SPATIAL_DIFFERENCING:
				setOrderOfSpatialDifferencing(ORDER_OF_SPATIAL_DIFFERENCING_EDEFAULT);
				return;
			case DataRepresentationsPackage.DATA_REPRESENTATION_TEMPLATE53__EXTRA_DIFFERENCING_OCTETS_NUMBER:
				setExtraDifferencingOctetsNumber(EXTRA_DIFFERENCING_OCTETS_NUMBER_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case DataRepresentationsPackage.DATA_REPRESENTATION_TEMPLATE53__ORDER_OF_SPATIAL_DIFFERENCING:
				return orderOfSpatialDifferencing != ORDER_OF_SPATIAL_DIFFERENCING_EDEFAULT;
			case DataRepresentationsPackage.DATA_REPRESENTATION_TEMPLATE53__EXTRA_DIFFERENCING_OCTETS_NUMBER:
				return extraDifferencingOctetsNumber != EXTRA_DIFFERENCING_OCTETS_NUMBER_EDEFAULT;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (orderOfSpatialDifferencing: "); //$NON-NLS-1$
		result.append(orderOfSpatialDifferencing);
		result.append(", extraDifferencingOctetsNumber: "); //$NON-NLS-1$
		result.append(extraDifferencingOctetsNumber);
		result.append(')');
		return result.toString();
	}

	/* (non-Javadoc)
	 * @see org.mro.grib.model.files.secondEdition.dataRepresentations.impl.DataRepresentationTemplate52Impl#initialise(java.nio.ByteBuffer)
	 */
	@Override
	public void initialise(ByteBuffer buffer) {
		super.initialise(buffer);
		orderOfSpatialDifferencing = buffer.get();
		extraDifferencingOctetsNumber = buffer.get();
	}
	
} //DataRepresentationTemplate53Impl
